<template>
  <div>
    <div class="gallery-Shelter" v-show ="show" @click="handleChangeShow" @touchmove.prevent>
      <div>
        <!-- swiper -->
        <swiper class="gallery-show" :options="swiperOption" >
          <!-- slides -->
          <swiper-slide v-for="(item ,index) in imgs " :key="index">
            <img class="swiper-img" :src="item" />
          </swiper-slide>
          <!-- Optional controls -->
          <div class="swiper-pagination" slot="pagination"></div>
        </swiper>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: "GalleryCarousel",
  props: {
    imgs: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  data() {
    return {
      swiperOption: {
        pagination: ".swiper-pagination",
        loop: false,
        paginationType: "fraction",
        observer: true,   //监听demo变化 改变宽度计算
        observeParents: true // 处理下标问题
      },
      show:true,
    };
  },
  methods:{
      handleChangeShow(){
          this.$emit('close')
      }
  }
};
</script>
<style scoped>
.gallery-Shelter {
  overflow: hidden;
  width: 100%;
  background: #000;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 99;
  display: flex;
  flex-direction: column;
  justify-content: center;
  /* align-items: center; */
}
.gallery-Shelter .gallery-show {
  /* overflow: hidden; */
  width: 100%;
  /* height: 400px; */
}
.gallery-Shelter .gallery-show .swiper-img {
  /* overflow: hidden; */
  width: 100%;
  /* height:100%; */
}
.gallery-Shelter >>> .swiper-pagination-fraction {
  position: relative;
  color: #cccccc;
  top: 100px;
}
.gallery-Shelter >>> .swiper-container {
  overflow: inherit;
}
</style>